** read in .dta file **

use "${clean}/who_counts_analysis.dta", clear

** Falsification Test: European farms, Freanch and Arabic Literacy 1945-1955, 1945-1962 **

** Regressions **

xi: reghdfe French_Lit did_edu_farm_wt Arabic Female *_itTREATEDEDU *_itFARM_WT, a(geo2_ma reg_fe YOB_BIN_5) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_farms_wt_BW2

xi: reghdfe French_Lit did_edu_farm Arabic Female *_itTREATEDEDU *_itFARM, a(geo2_ma reg_fe YOB_BIN_5) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_farms_BW2

drop if YOB > 1955

xi: reghdfe French_Lit did_edu_farm_wt Arabic Female *_itTREATEDEDU *_itFARM_WT, a(geo2_ma reg_fe YOB_BIN_5) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_farms_wt_BW1

xi: reghdfe French_Lit did_edu_farm Arabic Female *_itTREATEDEDU *_itFARM, a(geo2_ma reg_fe YOB_BIN_5) cluster(geo2_ma)
estadd local controls = "$\surd$",replace
estadd local adminFE = "$\surd$", replace 
estadd ysumm, replace
eststo m_LIT_farms_BW1

** Output Table **

#delimit ; 
estout m_LIT_farms_BW1
	   m_LIT_farms_wt_BW1
	   m_LIT_farms_BW2
	   m_LIT_farms_wt_BW2
       using "${output}/tables/TableA20.tex",
       style(tex) 
       cells(b(star fmt(3)) se(par fmt(3))) 
	   varlabels(did_farm "Difference in Differences, Farms"  did_farm_wt "Difference in Differences, 1950, Farms Weighted" did_edu_farm "Difference in Differences, Farms"  did_edu_farm_wt "Difference in Differences, Farms, Weighted"  Female "Female " Arabic "First Language Arabic ")
keep(did_edu_farm did_edu_farm_wt)
	   stats(controls
	   adminFE
             r2 
             N
			 ymean, fmt(0 0 2 0 3 %9.0gc %9.0gc)
             labels("\hline Controls"
			 "\hline Admin FE"
                   "\hline \(R^2\)" 
                  " \hline N"
				   "Dep. Var. Mean "))
       mlabels(,none) 
       numbers
       collabels(none) 
       starl(* 0.1 ** 0.05 *** 0.01)
	          prehead( 
           \begin{table}[H]
           \caption{Mechanism Test, European Farms}        
           \label{tab:DiD_FALSE_LIT}            
           \centering
           \begin{tabular}{@{\extracolsep{4pt}}l*{@M}{c}@{}} 
           \hline \hline             
		   & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic and French \\ 1945-1955}     
		    & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic and French \\ 1945-1955} 
		   & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic and French \\ 1945-1962}                   
   & \multicolumn{1}{p{3cm}}{\centering Literacy, Arabic and French \\ 1945-1962}             \\           
       )
       posthead(\hline) 
       prefoot() 
       postfoot(
           \noalign{\smallskip} \hline \hline 
           \end{tabular}
           \medskip
           \begin{minipage}{.9\textwidth}
           \tiny \justify Notes: \( @starlegend \). 
           \\ Fixed Effects and Clustered Robust Standard Errors at Province.
           \end{minipage}        
       \end{table}
       )
       replace;
#delimit cr
